cmake_minimum_required(VERSION 3.5)

project(QtRent VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)

qt_add_executable(QtRent
        main.cpp
        resource.qrc
        connection.h
        singleton.h singleton.cpp
        mainwindow.cpp mainwindow.h mainwindow.ui
        authorization.h authorization.cpp authorization.ui
        customwidget.h customwidget.cpp customwidget.ui
        proflepage.h proflepage.cpp proflepage.ui
        adspage.h adspage.cpp adspage.ui
        editads.h editads.cpp editads.ui
        adswidget.h adswidget.cpp adswidget.ui
        salestatus.h salestatus.cpp salestatus.ui
        editprofile.h editprofile.cpp editprofile.ui
        employeepage.h employeepage.cpp employeepage.ui
        customemployeewidget.h customemployeewidget.cpp customemployeewidget.ui
        aboutwindow.h aboutwindow.cpp aboutwindow.ui
        settings.h settings.cpp settings.ui
)

set_target_properties(QtRent PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

target_link_libraries(QtRent PUBLIC
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    Qt${QT_VERSION_MAJOR}::Sql
    Qt${QT_VERSION_MAJOR}::Widgets
)

install(TARGETS QtRent
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

if(QT_VERSION_MAJOR EQUAL 6)
    qt_finalize_executable(QtRent)
endif()
